// 
//  NBJEvent.m
//  nbj
//
//  Created by Francois Proulx on 09-09-20.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "NBJEvent.h"

#import "NBJEventAnnotation.h"

@implementation NBJEvent 

@dynamic address;
@dynamic date;
@dynamic longitude;
@dynamic latitude;
@dynamic eventId;
@dynamic guid;
@dynamic name;
@dynamic text;

@synthesize annotation;

- (void) dealloc
{
	[annotation release];
	[super dealloc];
}

- (NSString *) eventDescription
{
	return [NSString stringWithFormat:@"n°%02i - %@", [self.eventId integerValue], self.name];
}

// Returns the annotation, will automatically create one as needed
- (NBJEventAnnotation *) annotation
{
	if(!annotation) {
		annotation = [[NBJEventAnnotation alloc] initWithEvent:self];
	}
	
	return annotation;
}

// Returns any existing annotation
- (NBJEventAnnotation *) existingAnnotation
{
	return annotation;
}

@end
